#!/usr/bin/python3

import smtplib
from email.header import Header
from email.mime.text import MIMEText

sender = 'admin@sinowel.local'
receivers = ['wuweizhen@sinowel.com']

message = MIMEText('SMTP服务邮件发送测试...  请勿回复！收不到检查网页版邮箱中的隔离邮件！', 'plain', 'utf-8')

subject = 'SMTP服务邮件测试'
message['Subject'] = Header(subject, 'utf-8')

try:
    smtpObj = smtplib.SMTP('127.0.0.1', 25)
    smtpObj.sendmail(sender, receivers, message.as_string())
    print ("邮件发送成功")
except smtplib.SMTPException:
    print ("Error: 无法发送邮件")
